home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-09-14 | 1.8 KB | 82 lines | [TEXT/MPS ] |
- #
- # File: MountServer
- #
- # Contains: script to mount a server
- #
- # Usage: MountServer [[zone:]server]:[volume][:]
- #
- # Status: MountServer may return the following status values:
- #
- # 0 the server was mounted
- # 1 error
- # 2 the user canceled
- #
- # MountServer mounts a a server volume. If the volume is not already mounted,
- # it asks for a password for the volume.
- #
- # Written by: Darin Adler and scott douglass
- #
- # Copyright: © 1988, 1989 by Apple Computer, Inc., all rights reserved.
- #
- # Change History:
- #
- # 11/9/89 dba twiddle relentlessly
- #
- # To Do:
- #
-
- Set Exit 0
-
- # the following helps to debug until MPW sends echos to Dev:Console instead of Dev:StdErr
-
- If {Echo}
- Set somewhere "∑∑ '{Worksheet}'"
- Else
- Set somewhere "∑ Dev:Null"
- End
-
- Begin
-
- Set Server "{1}"
- Set ChooseErrors "{SystemFolder}ChooseErrors"
-
- # make sure that names are formed properly
-
- If "{Server}" =~ /([¬:]*)®2:([¬:]+)®3:«0,1»/
- Set Zone ""
- Set Server "{®2}"
- Set Volume "{®3}"
- Else If "{Server}" =~ /([¬:]*)®1:([¬:]+)®2:([¬:]+)®3:«0,1»/
- Set Zone "{®1}"
- Set Server "{®2}"
- Set Volume "{®3}"
- Else
- Alert "Can’t parse server name: “{Server}”"
- Exit 1
- End
-
- # check if the volume is mounted
-
- If `Exists "{Volume}:"`"" == ""
- # handle case where one volume from this server is already mounted (or empty password)
- Choose "{Zone}:{Server}:{Volume}" ≥ Dev:Null
- If {Status} ≠ 0
- Set IgnoreCmdPeriod 1
- Set Password "`CoolRequest -h -p "Enter your password on the “{Server}” server, please:"; Set GetPasswordStatus {Status}`"
- Set IgnoreCmdPeriod 0
- Exit 2 If {GetPasswordStatus}
-
- Choose "{Zone}:{Server}:{Volume}" -pw "{Password}" ∑ "{ChooseErrors}"
- Set ChooseStatus {Status}
- Unset Password
- If {ChooseStatus} ≠ 0
- Alert "`Catenate "{ChooseErrors}"`"
- Delete -i "{ChooseErrors}"
- Exit 1
- End
- Delete -i "{ChooseErrors}"
- End
- End
-
- End {somewhere}
-